﻿<UserControl x:Class="EasyInvoice.WPF.Content.User"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:app="clr-namespace:EasyInvoice.WPF" 
             xmlns:common="clr-namespace:EasyInvoice.WPF.Common"
             >

    <ScrollViewer Margin="{StaticResource RootMargin}">
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
                <StackPanel.Resources>
                    <Style TargetType="StackPanel">
                        <Setter Property="Orientation" Value="Horizontal" />
                        <Setter Property="Margin" Value="0,0,0,4" />
                    </Style>
                    <Style TargetType="TextBlock">
                        <Setter Property="Width" Value="150" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>
                </StackPanel.Resources>
            <TextBlock Text="User" Style="{StaticResource Title}" Margin="0,8,0,8"  />
            <StackPanel>
                    <TextBlock Text="Name"/>
                <TextBox  Width="350" Text="{Binding UserName,Mode=TwoWay,ValidatesOnDataErrors=True}" IsEnabled="{Binding PreventEdit}"/>
                </StackPanel>
                <StackPanel>
                    <TextBlock Text="Password"/>
                <PasswordBox MinWidth="350" MaxLength="40" 
                                 common:PasswordHelper.Attach="True"
                                 common:PasswordHelper.Password="{Binding Text,ElementName=plain,Mode=TwoWay}"
                                 />
                <TextBlock Padding="10,0" x:Name="plain" Text="{Binding Password,Mode=TwoWay}" Visibility="Hidden"/>
            </StackPanel>
                <!--<StackPanel>
                    <TextBlock Text="Rights"/>
                    <TextBox  Width="350" Text="{Binding Rights,Mode=TwoWay}"/>
                </StackPanel>-->
            <TextBlock Text="Rights" Style="{StaticResource Heading2}" Margin="0,16,0,16"  />
            <StackPanel>
                <TextBlock Text="Invoices"/>
                <CheckBox Content="View" Margin="0,0,8,0" IsChecked="{Binding ViewInvoices }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Add" Margin="0,0,8,0" IsChecked="{Binding AddInvoices }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Edit" Margin="0,0,8,0" IsChecked="{Binding EditInvoices }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Delete" Margin="0,0,8,0" IsChecked="{Binding DeleteInvoices }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Print" Margin="0,0,8,0" IsChecked="{Binding PrintInvoices }" IsEnabled="{Binding PreventEdit}"/>
            </StackPanel>
            <StackPanel>
                <TextBlock Text="Clients"/>
                <CheckBox Content="View" Margin="0,0,8,0" IsChecked="{Binding ViewClients }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Add" Margin="0,0,8,0" IsChecked="{Binding AddClients }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Edit" Margin="0,0,8,0" IsChecked="{Binding EditClients }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Delete" Margin="0,0,8,0" IsChecked="{Binding DeleteClients }" IsEnabled="{Binding PreventEdit}"/>
            </StackPanel>
            <StackPanel>
                <TextBlock Text="Users"/>
                <CheckBox Content="View" Margin="0,0,8,0" IsChecked="{Binding ViewUsers }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Add" Margin="0,0,8,0"  IsChecked="{Binding AddUsers }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Edit" Margin="0,0,8,0" IsChecked="{Binding EditUsers }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Delete" Margin="0,0,8,0" IsChecked="{Binding DeleteUsers }" IsEnabled="{Binding PreventEdit}"/>
            </StackPanel>
            <StackPanel>
                <TextBlock Text="Settings"/>
                <CheckBox Content="View" Margin="0,0,8,0"  IsChecked="{Binding ViewSettings}" IsEnabled="{Binding PreventEdit}"/>
            </StackPanel>
            <StackPanel>
                <TextBlock Text=""/>
                <CheckBox Content="Appearance" Margin="0,0,8,0"  IsChecked="{Binding EditSettingsAppearance }" Visibility="Collapsed" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Export" Margin="0,0,8,0" IsChecked="{Binding EditSettingsExport }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Email" Margin="0,0,8,0" IsChecked="{Binding EditSettingsEmail }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Options" Margin="0,0,8,0" IsChecked="{Binding EditSettingsOptions }" IsEnabled="{Binding PreventEdit}"/>
                <CheckBox Content="Database" Margin="0,0,8,0"  IsChecked="{Binding EditSettingsDatabase }" IsEnabled="{Binding PreventEdit}"/>
            </StackPanel>
            <StackPanel >
                <TextBlock/>
                <Button Command="{Binding ShowSaveCommand}" Content="save" Margin="0,32,0,8" Width="140"/>
            </StackPanel>
        </StackPanel>
        </ScrollViewer>
</UserControl>
